#ifndef THREAD_H
#define THREAD_H

#include <QtCore/QThread>
#include<QFile>
#include<errorinfo.h>

enum thread_type_of_Python{
    isNot,
    py_filelist,
    py_control_xml,
    py_script,
    py_set_script
};

class Thread : public QThread
{
    Q_OBJECT
public:
    Thread(QString path, QString name, QString runpath);//解压
    Thread(QString pack_command);//打包
    Thread(int bFlag_type, QString str_Source, QString cache_dir, thread_type_of_Python thread_type );//python，生成文件
    ~Thread();
    void extractdebdata(QString debfile_path, QString  soft_name, QString runPath);
    void package(QString pack_command);
    void createCPKfilelist();
    void createControlXML();
    void createScript();
    void setScript();

//    bool judge_error();

signals:
     void signal_Msg_extract_end();//用于向主线程传递
     void signal_Msg_pack_end(QString str_Msg_error);
     void signal_Msg_error(QString str_Msg_error);

     void signal_Msg_py_end(int thread_type);
     void signal_Msg_py_filelist_end();
     void signal_Msg_py_control_xml_end();
     void signal_Msg_py_script_end();
     void signal_Msg_py_set_script_end();

public:
   QString debfile_path; //文件路径
   QString  soft_name; //软件名称
   QString  runPath; //运行目录
   QString cache_dir; //临时目录
   QString pack_command; //打包命令
   int bFlag_type; //1表示打包,2表示转包
   QString cpk_path; //CPK文件夹路径
   QString str_Source;
   thread_type_of_Python thread_type; //python类型
   bool bflag;
   bool bflag_c;
   int intClassification; //1---解压操作;2---打包操作
//   bool isError;//

protected:
    void run();
};

#endif // THREAD_H

